<template>
  <view class="empty" :style="[emptyStyle]">
    <image
      src="@/static/image/components/empty.png"
      class="empty__image"
    ></image>
    <text class="empty__content">{{ content }}</text>
  </view>
</template>

<script>
export default {
  name: "Empty",
  props: {
    content: {
      type: String,
      default: function () {
        return "暂无数据";
      },
    },
    marginTop: {
      type: [String, Number],
      default: "200rpx",
    },
  },
  data() {
    return {};
  },
  computed: {
    emptyStyle() {
      let style = {};

      if (typeof this.marginTop === "string") {
        style.marginTop = this.marginTop;
      }

      if (typeof this.marginTop === "number") {
        style.marginTop = this.marginTop + "rpx";
      }

      return style;
    },
  },
};
</script>

<style lang="scss" scoped>
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  // padding: 40rpx 0;

  &__image {
    width: 410rpx;
    height: 300rpx;
    object-fit: cover;
  }

  &__content {
    font-size: 34rpx;
    color: #282828;
    margin-top: 44rpx;
  }
}
</style>
